<#include "/header.ftl">

<script type="text/javascript" src="js/jquery.min.js"></script>
<form action="/user/user" method="post">
<table  width="289" height="184" border="1">
	<tr>
		<td align="center">编号</td>
		<td align="center">姓名</td>
		<td align="center">密码</td>
		<td align="center">联系方式</td>
		<td align="center">性别</td>
		<td align="center"><a href="/user/insert">增加</a></td>
		<td align="center"><input type="text"  id="text_1" size="5" />查找用户</td>
	</tr>	
	<#list list as user>
	<tr id="${user.userId}">
		<td align="center">${user.userId}</td>
		<td align="center">${user.userName}</td>
		<td align="center">${user.pwdword}</td>
		<td align="center">${user.telephone}</td>
		<td align="center">${user.sex}</td>
		<td align="center"><a href="javascript:void(0)" onclick="delete(${user.userId})">删除</a></td>
		<td align="center"><a href="/user/update.action?userId=${user.userId}">修改</a></td>
     </tr>
     </#list>
</table>
			<div class="page">
				<a href="javascript:void(0)" onclick="page()">首页</a> 
				<a href="javascript:void(0)" onclick="page()">上一页</a> 
				<a href="javascript:void(0)" onclick="page()">下一页</a> 
				<a href="javascript:void(0)" onclick="page()">尾页</a>
			</div>	
</form>

<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript">
   function delete(userId){//删除用户信息
	alert("确认删除？");
	$.ajax({
			url:"/user/delete",//请求地址
			type:"post",//提交方式
			async:true,//是否支持异步刷新，默认是true
			data:"id="+userId,//发送服务器的数据，需要提交的数据
			dataType:"json",//服务器响应数据格式
			contentType:"application/x-www-form-urlencoded; charset=utf-8", 
			success:function(data){//服务器响应的内容
			 $("#table tr:id").remove() };
			error: function (XMLHttpRequest, textStatus, errorThrown) { 
                alert(errorThrown)} ;                              
			 })
			 }

<#include "/footer.ftl">